from django.db import models

from clazz.models import Clazz
from course.models import Course


# Create your models here.

class Student(models.Model):
    student_no = models.CharField(max_length=30, unique=True)
    student_name = models.CharField(max_length=30)
    student_age = models.IntegerField()
    student_gender = models.SmallIntegerField(choices=((1, "男"), (2, "女")))
    #  级联删除
    clazz = models.ForeignKey(Clazz, on_delete=models.CASCADE)
    #  级联保护
    course = models.ForeignKey(Course, on_delete=models.PROTECT)
    school_time = models.DateTimeField()

    class Meta:
        db_table = 'student'
